#!/usr/bin/env bats

@test "filter around no-color no-case: 2 words" {
  cd $BATS_TEST_DIRNAME
  expected="file11-20-overwhelming world. Either way, your presence is doing its job, giving her the
file11-21-safety to express her emotions—and to feel heard. This crying actually releases
file11:22:stress hormones. Think of it this way: She had a hard day, or (even months ago)
file11-23-a hard birth, and she wants to tell you about it. She may be crying, but it’s a
file11-24-good, cleansing cry. She’s releasing all the cortisol, adrenaline, and other"
  result="$(fish -c 'tbgs Think about')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs think about')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs think aBout')"; [ "$result" = "$expected" ]
  expected="file11-8-You're the facilitator for your baby to build a brain and nervous system that
file11-9-makes it easy for him to manage his anxiety for the rest of his life.
file11:10:Anyone who's ever spent time with a newborn knows they can be difficult to
file11-11-soothe. Don't worry. Your baby's brain development doesn't require that you be
file11-12-perfect. Human parents never are. You only have to be good enough, so that most
--
file11-20-overwhelming world. Either way, your presence is doing its job, giving her the
file11-21-safety to express her emotions—and to feel heard. This crying actually releases
file11:22:stress hormones. Think of it this way: She had a hard day, or (even months ago)
file11-23-a hard birth, and she wants to tell you about it. She may be crying, but it’s a
file11-24-good, cleansing cry. She’s releasing all the cortisol, adrenaline, and other
file11:25:pent-up stress hormones from her overstimulating experiences in this crazy new
file11-26-world. Because you’re holding her, her body is responding to her crying by
file11-27-building"
  result="$(fish -c 'tbgs one new')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs One NeW')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs One new')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs one New')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs ONe nEW')"; [ "$result" = "$expected" ]
}

@test "filter around no-color no-case: 4 words" {
  cd $BATS_TEST_DIRNAME
  expected="file11-24-good, cleansing cry. She’s releasing all the cortisol, adrenaline, and other
file11-25-pent-up stress hormones from her overstimulating experiences in this crazy new
file11:26:world. Because you’re holding her, her body is responding to her crying by
file11-27-building"
  result="$(fish -c 'tbgs Because holding horm over')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs holding horm over Because')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs because holding horm over')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs Because holDing horm over')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs Because holding hoRm over')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs Because holding horm oveR')"; [ "$result" = "$expected" ]
}

@test "filter around no-color no-case: 2 words partial match" {
  cd $BATS_TEST_DIRNAME
  expected="file11-18-stressful to infants. She may be in pain or she may simply be overstimulated
file11-19-and need to release all those pent-up stresses of being newly alive in an
file11:20:overwhelming world. Either way, your presence is doing its job, giving her the
file11-21-safety to express her emotions—and to feel heard. This crying actually releases
file11-22-stress hormones. Think of it this way: She had a hard day, or (even months ago)"
  result="$(fish -c 'tbgs overwhel Eit')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs OvErWhel eit')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs overwhel eit')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs Eit overwhel')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs eit OvErWhel')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs eit overwhel')"; [ "$result" = "$expected" ]
}

@test "filter around no-color no-case: 2 words word only appears in file path" {
  cd $BATS_TEST_DIRNAME
  expected=""
  result="$(fish -c 'tbgs the file')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs file never')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs Because file')"; [ "$result" = "$expected" ]
}
